#pragma once

#include <MyFC/Utility.h>	   
#include <MyFC/Glyph.h>

#include "Panels.h"

namespace My {

class Frame;

/**
 * Splitter that separates the right panel bar
 * and the view
 */
class RightSplitter : public My::Control {
private:
	Frame &		m_Frame;
	int			m_Start;
	int			m_Pos;
public:
	RightSplitter(Frame & f);
public:
	virtual CRect Bounds() const;
	virtual void HandlePaint(CDC * pDC, const CRect & r);
	virtual bool HandleDragStart(unsigned int flags, const CPoint & p0, const CPoint & p);
	virtual void HandleDragEnd(unsigned int flags, const CPoint & p);
	virtual void HandleDragging(unsigned int flags, const CPoint & p);
	virtual bool HandleCursor(unsigned int flags, const CPoint & p);
};

/**
 * Splitter that separates the bottom panel bar
 * and the view
 */
class BottomSplitter : public My::Control {
private:
	Frame &		m_Frame;
	int			m_Start;
	int			m_Pos;
public:
	BottomSplitter(Frame & f);
public:
	virtual CRect Bounds() const;
	virtual void HandlePaint(CDC * pDC, const CRect & r);
	virtual bool HandleDragStart(unsigned int flags, const CPoint & p0, const CPoint & p);
	virtual void HandleDragEnd(unsigned int flags, const CPoint & p);
	virtual void HandleDragging(unsigned int flags, const CPoint & p);
	virtual bool HandleCursor(unsigned int flags, const CPoint & p);
};

/**
 * Grip for the splitters' intersection
 */
class CornerGrip : public My::Control {
private:
	Frame &			m_Frame;
	My::Glyph		m_Glyph;
	My::Glyph		m_GlyphUp;
	CPoint			m_Start;
	CPoint			m_Pos;
public: 
	CornerGrip(Frame & f);
public:
	virtual CRect Bounds() const;
	virtual void HandlePaint(CDC * pDC, const CRect & r);
	virtual void HandleLeftUp(unsigned int flags, const CPoint & p);
	virtual bool HandleDragStart(unsigned int flags, const CPoint & p0, const CPoint & p);
	virtual void HandleDragEnd(unsigned int flags, const CPoint & p);
	virtual void HandleDragging(unsigned int flags, const CPoint & p);
	virtual bool HandleCursor(unsigned int flags, const CPoint & p);
};

/**
 * Middle grip for the right splitter
 */
class RightGrip : public My::Control {
private:
	Frame &			m_Frame;
	My::Glyph		m_Glyph;
	My::Glyph		m_GlyphBack;
	int				m_Start;
	int				m_Pos;
public: 
	RightGrip(Frame & f);
public:
	virtual CRect Bounds() const;
	virtual void HandlePaint(CDC * pDC, const CRect & r);
	virtual void HandleLeftUp(unsigned int flags, const CPoint & p);
	virtual bool HandleDragStart(unsigned int flags, const CPoint & p0, const CPoint & p);
	virtual void HandleDragEnd(unsigned int flags, const CPoint & p);
	virtual void HandleDragging(unsigned int flags, const CPoint & p);
	virtual bool HandleCursor(unsigned int flags, const CPoint & p);
};

/**
 * Middle grip for the bottom splitter
 */
class BottomGrip : public My::Control {
private:
	Frame &			m_Frame;
	My::Glyph		m_Glyph;
	My::Glyph		m_GlyphBack;
	int				m_Start;
	int				m_Pos;
public: 
	BottomGrip(Frame & f);
public:
	virtual CRect Bounds() const;
	virtual void HandlePaint(CDC * pDC, const CRect & r);
	virtual void HandleLeftUp(unsigned int flags, const CPoint & p);
	virtual bool HandleDragStart(unsigned int flags, const CPoint & p0, const CPoint & p);
	virtual void HandleDragEnd(unsigned int flags, const CPoint & p);
	virtual void HandleDragging(unsigned int flags, const CPoint & p);
	virtual bool HandleCursor(unsigned int flags, const CPoint & p);
};

} // My